<?php
// +----------------------------------------------------------------------
// | najing [ 通用后台管理系统 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://www.najingquan.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 救火队队长
// +----------------------------------------------------------------------

namespace app\cardeadmin\controller;

use app\common\controller\AdminController;
use app\common\model\ActionError;
use app\common\model\ApiAcceptCom;
use app\common\model\ApiAcceptLss;
use think\facade\Cache;
use think\facade\Db;
use think\facade\View;

/**
 * 平台设置
 * Class Setting
 * @package app\admin\controller
 */
class AcceptLog extends AdminController
{
    /**
     * 平台设置
     * @author 救火队队长
     */
    public function index()
    {
        if($this->request->isPost()) {
            $data = input('param.');
            $model = new ApiAcceptCom();
            return $model->tableDataAdmin($data);
        }
        return View::fetch();
    }

    public function lssLog()
    {
        if($this->request->isPost()) {
            $data = input('param.');
            $model = new ApiAcceptLss();
            return $model->tableDataAdmin($data);
        }
        return View::fetch();
    }

    public function showDetail()
    {
        $id     = input('get.id');
        $type   = input('get.type');
        $db_name= '';
        switch ($type){
            case "cd":
                $db_name = 'api_accept_com';
                break;
            case "lss":
                $db_name = 'api_accept_lss';
                break;
        }
        $list  = Db::name($db_name)->where(['id' => $id])->find();

        View::assign([
            'json_data'           => $list['json_data'],
        ]);
        View::layout(false);
        return [
            'status'    => 1,
            'datas'     => View::fetch()
        ];
    }
}